{include file="public/header2"}
<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-card-body">
      <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
        <div class="layui-form-item">
          <label class="layui-form-label">选择角色</label>
          <div class="layui-input-inline">
            <select name="role_id" lay-filter="aihao" lay-verify="required">
              <option value="">请选择角色</option>
              {volist name="role_list" id="vo"}
              <option value="{$vo.id}" {notempty name="$data.role_id"}{eq name="$info.role_id" value="$vo.id"} selected{/eq}{/notempty}>{$vo.name}</option>
              {/volist}
            </select>
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">用户名</label>
          <div class="layui-input-inline">
            <input type="text" name="username" class="layui-input" lay-verify="required" />
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">手机</label>
          <div class="layui-input-inline">
            <input type="text" name="phone" class="layui-input" lay-verify="required" />
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">性别</label>
          <div class="layui-input-inline">
            <input type="radio" name="sex" value="1" title="男" >
            <input type="radio" name="sex" value="2" title="女" >
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">密码</label>
          <div class="layui-input-inline">
            <input name="password" id="LAY_password" placeholder="请输入密码" autocomplete="off" class="layui-input" type="password" lay-verify="pass" lay-verType="tips">
          </div>
          <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">重复密码</label>
          <div class="layui-input-inline">
            <input name="password_confirm"  placeholder="请再次输入密码" autocomplete="off" class="layui-input" type="password" lay-verify="repass" lay-verType="tips">
          </div>
        </div>
        <div class="layui-form-item layui-hide">
          <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="添加">
        </div>
      </div>
    </div>
  </div>
</div>




<div class="tplay-body-div">

  <div style="margin-top: 20px;">
  </div>
  <form id="admin"  class="layui-form"  >
    <div class="layui-form-item">
      <label class="layui-form-label">选择角色</label>
      <div class="layui-input-inline">
        <select name="role_id" lay-filter="aihao" lay-verify="required">
          <option value="">请选择角色</option>
          {volist name="roleData" id="vo"}
          <option value="{$vo.id}" {notempty name="$info.role_id"}{eq name="$info.role_id" value="$vo.id"} selected=""{/eq}{/notempty} >{$vo.name}</option>
          {/volist}
        </select>
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">用户名</label>
      <div class="layui-input-inline">
        <input name="username" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input" type="text" {notempty name="$info.member.username"}value="{$info.member.username}"{/notempty}>
      </div>

    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">昵称</label>
      <div class="layui-input-inline">
        <input name="nick_name"  placeholder="请输入" autocomplete="off" class="layui-input" type="text" {notempty name="$info.member.nick_name"}value="{$info.member.nick_name}"{/notempty}>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">新密码</label>
      <div class="layui-input-inline">
        <input name="password"  placeholder="请输入新密码" autocomplete="off" class="layui-input" type="password">
      </div>
      <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">重复新密码</label>
      <div class="layui-input-inline">
        <input name="password_confirm"  placeholder="请再次输入新密码" autocomplete="off" class="layui-input" type="password">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">是否启用</label>
      <div class="layui-input-block">
        <input type="radio" name="status" value="0" title="禁用" {eq name="info.member.status" value="0"}checked=""{/eq}checked="">
        <input type="radio" name="status" value="1"  title="启用"{eq name="info.member.status" value="1"}checked=""{/eq} >
      </div>
    </div>
    {notempty name="$info.member"}
    <input name="id"  type="hidden" {notempty name="$info.member.id"}value="{$info.member.id}"{/notempty}>
    {/notempty}
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn"  lay-submit lay-filter="admin" onclick="return false;">立即提交</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>

  </form>

  <script>
      layui.use(['layer', 'form'], function() {
          var layer = layui.layer,
              $ = layui.jquery,
              form = layui.form;
          $(window).on('load', function() {
              form.on('submit(admin)', function(data) {
                  $.ajax({
                      url:"{:url('admin/Member/editMember')}",
                      data:$('#admin').serialize(),
                      type:'post',
                      async: false,
                      success:function(res) {
                          if(res.code == 1) {
                              layer.alert(res.msg, function(index){
                                  location.href = res.url;
                              })
                          } else if(res.code == 0) {
                              layer.msg(res.msg);
                          }
                      }
                  })
              });
          });
      });
  </script>
</div>
{include file="public/footer"}